<?php
require_once(dirname(__FILE__)."/../config/session.php");
require_once(dirname(__FILE__)."/../config/config.inc.php");
require_once(dirname(__FILE__)."/../libs/string/libstr.php");
require_once(dirname(__FILE__)."/../libs/dbclass/dbconn.php");
require_once(dirname(__FILE__)."/../libs/dbclass/dbservice.php");
require_once(dirname(__FILE__)."/../libs/login/login.php");
$mc=new libstr();
$db=new dbconn();
$dbs=new dbservice();
$lp=new login();

if($mc->Ismp($_POST["regbtn"])!="")
{

     if(trim($mc->Ismp($_POST["keycode"]))!="")
	 {
	   if(!$mc->isnum($_POST["keycode"]))
	 {
	// $mc->msg("机器码格式错误","go");
	 }
	 $dv=$db->dvstr("select count(id) as ok from keycontent where keycode='".$_POST["keycode"]."'");
if($dv["ok"]==0)
{
$mc->msg("系统不存在您的机器码，或者您输入错误。如有疑问请联系我们的工作人员。","go");
}


	 }
	if($lp->reg(trim($_POST["userid"]),$_POST["userid"],trim($_POST["password"]),$_POST["cpassword"],$_POST["email"],true,strtolower(trim($_POST["code"])),"","0","","",$_POST["shouji"]))
	{
		$lp->member_login(trim($_POST["userid"]),trim($_POST["password"]),"",false);
		  if(trim($mc->Ismp($_POST["keycode"]))!="")
	 {
	  // if($mc->isnum($_POST["keycode"]))
	// {
		$db->cmd("insert into user_keycode(keycode,beizhu,usercode,ip,updatetime)values('".$_POST["keycode"]."','--',".$lp->getsession("userno").",'".$mc->getip()."','".date("Y-m-d H:s:i")."')");
		//}
		}
		echo "注册成功,感谢您的注册！";
		if($mc->Ismp($_REQUEST["gourl"])!="")
		{
			$mc->msg("",$_REQUEST["gourl"]);
		}else 
		{
					if($mc->Ismp($_GET["net"])=="true")
{
	$mc->msg("","../netshop/uc_myfile.php");
}
			$mc->msg("","../uc_index.php");
		}
	}else 
	{
		$mc->msg("注册失败","go");
	}
}
if(trim($mc->Ismp($_GET["userid"]))!="")
{
		$myts=$dbs->dvstr("select count(*) as t from member_content where userid='".trim($_GET['userid'])."'");
		if($myts["t"]!="0")
		{
			echo "ckuseryes";
			//$mc->msg("已经存在相同的帐号，请选择另一个","go");
		}else 
		{
			echo "ckuserno";
		}
}
if(trim($mc->Ismp($_GET["code"]))!="")
{
	if(strtolower(trim($_GET["code"]))!=strtolower(trim($_SESSION["code"])))
	{
		echo  "ckcodeno";
	}
}
?>